#pragma once

struct LoginData;
class PlayerManager
{
public:
	PlayerManager();
	~PlayerManager();

public:
	void addPlayer(Player *);

public:
	UInt32 getOnlineCount() { return _onlineCount; }
	Int32 getPlayerSession(UInt64);
	Player * getPlayer(UInt64);
	bool existPlayer(UInt64);

public:
	void leavePlayer(UInt64);
	void enterPlayer(Player *);
	bool tryReConnPlayer(UInt64, UInt32, Int32, Player *&);

	void goHall(Player *, bool = true);
	void kickPlayer(UInt64, bool = true);

public:
	void update(UInt32);

protected:
	UInt32 _onlineCount;
	std::unordered_map<UInt64, Player *> _players;
};